home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-15 | 3.4 KB | 207 lines | [TEXT/MPS ] |
- ;********************************************************************
- ; (c) Copyright 1990-91 by Apple Computer, Inc. All rights reserved.
- ;
- ; LAPAsmUtil.a contains various utility routines useful in writing I/O routines
- ;
- ;********************************************************************
- TITLE 'LAPAsmUtil'
- CASE OBJ
- ;
- ; 1.2 11/29/90 Rajesh modified for IEEE 802.3 LAP
- ; 1.0d2 1/20/88 JEM Convert to MPW assembler from C
- ; 1.0d1 9/16/87 JEM Initial MacOS version
- ;
-
- INCLUDE 'SysEqu.a'
- INCLUDE 'Traps.a'
-
- ;
- ; long GetA0()
- ;
- ; Return contents of A0 to caller
- ;
- GetA0 PROC EXPORT
- move.l a0,d0
- rts
- ENDPROC
-
- ;
- ; long SetA0()
- ;
- ; Store contents of D0 in A0
- ;
- SetA0 PROC EXPORT
- ARG1 SET 4
- movem.l ARG1(sp),d0
- move.l d0,a0
- rts
- ENDPROC
-
- ;
- ; long GetA1()
- ;
- ; Return contents of A1 to caller
- ;
- GetA1 PROC EXPORT
- move.l a1,d0
- rts
- ENDPROC
-
- ;
- ; long GetD0()
- ;
- ; Return contents of D0 to caller
- ;
- GetD0 PROC EXPORT
- move.l d0,d0
- rts
- ENDPROC
-
- ;
- ; long SetD0()
- ;
- ; Store contents of D0 in D0
- ;
- SetD0 PROC EXPORT
- ARG1 SET 4
- movem.l ARG1(sp),d0
- move.l d0,d0
- rts
- ENDPROC
-
- ;
- ; long SetD1()
- ;
- ; Store contents of D0 in D1
- ;
- SetD1 PROC EXPORT
- ARG1 SET 4
- movem.l ARG1(sp),d0
- move.l d0,d1
- rts
- ENDPROC
-
- ;
- ; long GetD2()
- ;
- ; Return contents of D2 to caller
- ;
- GetD2 PROC EXPORT
- move.l d2,d0
- rts
- ENDPROC
-
- ;
- ; long SetD2()
- ;
- ; Store contents of D0 in D2
- ;
- SetD2 PROC EXPORT
- ARG1 SET 4
- movem.l ARG1(sp),d0
- move.l d0,d2
- rts
- ENDPROC
-
- ;
- ; long GetA5()
- ;
- ; Return contents of A5 to caller
- ;
- GetA5 PROC EXPORT
- move.l a5,d0
- rts
- ENDPROC
-
- ;
- ; long A5Swap (oldA5)
- ;
- A5Swap PROC EXPORT
- ARG1 SET 0*4 + 4
- move.l a5,d0
- move.l ARG1(sp), a5
- rts
- ENDPROC
-
- ;
- ; void bzero(ptr, cnt)
- ; char *ptr;
- ; int cnt;
- ;
- ; Clear a block of memory starting from "ptr" (a0) with size "cnt" bytes (d0)
- ;
- bzero PROC EXPORT
- ARG1 SET 4
- ARG2 SET ARG1+4
-
- move.l ARG1(sp),a0 ;get pointer to area to zero
- move.l ARG2(sp),d0 ;and its length in bytes
- bra.s @20
-
- @10 clr.b (a0)+ ;clear a byte
- @20 dbra d0, @10
- rts
- ENDPROC
-
-
- ;
- ; IOComplete(ioPB)
- ; struct CntrlParam *ioPb;
- ;
- ; IOComplete performs the I/O completion handling on an IOP
- ;
-
- IOComplete PROC EXPORT
- movem.l d0-d2/a0-a1, -(sp) ;save registers
- ARG1 SET 5*4 + 4
- move.l ARG1(sp), a0 ;get ioPB
- move.w ioResult(a0), d0 ;get result code
- cmp.w #1, d0
- bne.s @1
- pea.l #'MacTCP--IOC w/ ioResult == 1'
- _DebugStr
- @1 move.l ioCompletion(a0), d1 ;check if I/O completion routine
- beq.s @10 ;if not, just return
- move.l a0,-(sp) ;push ioPB in case calling C routine
- move.l d1,a1
- tst.w d0 ;set condition flags
- jsr (a1) ;call completion routine
- add.l #4,sp ;clean-up stack
- @10 movem.l (sp)+, d0-d2/a0-a1 ;restore registers
- rts
- ENDPROC
-
-
- ;
- ; Disable();
- ;
- ; Allows procedures written in a hi-level language ("C") to
- ; turn off interrupts from the SCC. This call must be balanced
- ; by a call to "Enable()"
- ;
-
- Disable PROC EXPORT
- SCCLockout EQU $2600
- moveq #0,d0 ;return old status register
- move.w sr,d0
- move.w #SCCLockout,sr ;disable interrupts
- rts
- ENDPROC
-
- ;
- ; void Enable(sr)
- ; int sr;
- ;
- ; Allows procedures written in a hi-level language ("C") to
- ; re-enable interrupts from the SCC. This call should only
- ; be used to balance a previously made call to "Disable()"
- ;
-
- Enable PROC EXPORT
- ARG1 SET 4
- move.l ARG1(sp),d0
- move.w d0,sr ;replace status register
- rts
- ENDPROC
- END
-